//
//  ZKTransitionAnimatedConfig.m
//  朱凯的工具箱
//
//  Created by pro on 17/5/12.
//  Copyright © 2017年 zhukai. All rights reserved.
//

#import "KZTransitionAnimatedConfig.h"

@implementation KZTransitionAnimatedConfig
{
    NSTimeInterval          _duration;  // 动画时长
    KZAnimatedConfigBlock   _config;    // 动画配置，外部实现
}
- (instancetype)initWithDuration:(NSTimeInterval)duration
                          config:(KZAnimatedConfigBlock)config {
    
    if (self = [super init]) {
        
        _duration = duration;
        _config = config;
    }
    return self;
}

- (NSTimeInterval)transitionDuration:(nullable id <UIViewControllerContextTransitioning>)transitionContext {
    
    return _duration;
}
- (void)animateTransition:(id <UIViewControllerContextTransitioning>)transitionContext {
    
    if (_config) {
        _config(transitionContext);
    }
}


@end
